/**
 * 专业班级表model
 * author:cjf
 * 专业班级编号(major_id)描述(Integer、唯一、非空)、专业班级名称(major_name)描述(String(100)、非空)
 * 教师编号(teacher_id)描述(Integer、非空)
 */
import { DbContext } from '@codefree/badger/service'
const db = DbContext.Sequelize;

export type MajorEntity = {
    major_id:Number,
    major_name:String,
    teacher_id:Number
}

const majorEntity:MajorEntity = {
    major_id:{
        type:db.INTEGER,
        unique:true,
        allowNull:false
    },
    major_name:{
        type:db.STRING(100),
        allowNull:false
    },
    teacher_id:{
        type:db.INTEGER,
        allowNull:false
    }
}

export default (sequelize) => {
    return {
        name: 'Major',
        define: sequelize.define("major", majorEntity, DbContext.defaultOptions)
    }
}